package cn.green.core.components.table.t;

import cn.green.core.components.table.TableTypeCom;
import cn.green.core.excel.model.Column;
import cn.green.core.model.QTable;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author wang.yishu
 * @version 1.0
 * @className QListTable
 * @description Q组件本身提供的列表类型
 * @date 2025/2/28 10:01
 */
public abstract class QListTable implements TableTypeCom {

    @Override
    public boolean canBuildConditionSql() {
        return true;
    }

    @Override
    public JSONArray arrangeData(JSONArray data, QTable table, JSONObject param) {
        //return data.stream().filter(item -> condition.hit(table, (JSONObject) item, param)).collect(Collectors.toCollection(JSONArray::new));
        return data;
    }

    @Override
    public JSONObject arrangeDetail(JSONObject detail, QTable table) {
        return detail;
    }

    @Override
    public List<Column> tableColumns(QTable table) {
        return Collections.emptyList();
    }
}
